﻿/// <reference path="jquery-2.1.4.min.js" />
/// <reference path="createjs.js" />

var stage = new createjs.Stage("gameView");
var Container0 = new createjs.Container;
var Container1 = new createjs.Container;
var Container2 = new createjs.Container;
var Container3 = new createjs.Container;
var Container31 = new createjs.Container;
var Container4 = new createjs.Container;
var Container5 = new createjs.Container;
var Container6 = new createjs.Container;
var Container7 = new createjs.Container;
var Container8 = new createjs.Container;
var Container9 = new createjs.Container;
var Container10 = new createjs.Container;
var Container11 = new createjs.Container;
var Container12 = new createjs.Container;
var Container13 = new createjs.Container;

var queue = new createjs.LoadQueue();
var LoadCanvas = function() {
	try {
//		alert(openid);
		$.post("shuju.php?jieshou=AddUser",{openid:openid},function(text){
			console.log(text);
			var xinxi = JSON.parse(text)[0];
			var xingming = xinxi.xingming;
			var xingbie = xinxi.xingbie;
			var dianhua = xinxi.dianhua;
			var chengshi = xinxi.chengshi;
			$("#xingming").val(xingming);
			$("#xingbie span").html(xingbie);
			$("#dianhua").val(dianhua);
//			$("#demo2").val(chengshi);
			$("#chengshi span").html(chengshi);
		})
	    var image = "http://www.jkera.cn/fengtian/image/share.jpg";
	    var url1 = "http://www.jkera.cn/fengtian/fabu.html";
	    fenxiang("全新RAV4荣放带你用极限操控勇敢迎接挑战，一起来体验吧！","全新RAV4荣放带你用极限操控勇敢迎接挑战，一起来体验吧！","全新RAV4荣放带你用极限操控勇敢迎接挑战，一起来体验吧！", url1, image, "");
	}
	catch (err) {
		
	}

	/////////////////////////启动触摸
	createjs.Touch.enable(stage);

	queue.loadManifest([
		{src: "/tishi.png",id: "tishi"},
		{src: "image1/che1.png",id: "che1"},
		{src: "image1/dibu.jpg",id: "dibu"},
		{src: "image1/dingbu.png",id: "dingbu"},
		{src: "image1/kaishiyouxi.png",id: "kaishiyouxi"},
		{src: "image1/logo1.png",id: "logo1"},
		{src: "image1/logo2.png",id: "logo2"},
		{src: "image1/men.png",id: "men"},
		{src: "image1/renwu.png",id: "renwu"},
		{src: "image1/wenzi11.png",id: "wenzi11"},
		{src: "image1/wenzi12.png",id: "wenzi12"},
		{src: "image1/wenzi13.png",id: "wenzi13"},
		{src: "image1/wenzi14.png",id: "wenzi14"},
		
		{src: "image2/che2.png",id: "che2"},
		{src: "image2/jinruyouxi.png",id: "jinruyouxi"},
		{src: "image2/wenzi21.png",id: "wenzi21"},
		{src: "image2/wenzi22.png",id: "wenzi22"},
		{src: "image2/wenzi23.png",id: "wenzi23"},
		{src: "image2/wenzi24.png",id: "wenzi24"},
		
		{src: "image3/che3.png",id: "che3"},
		{src: "image3/chufa.png",id: "chufa"},
		{src: "image3/ditu.png",id: "ditu"},
		{src: "image3/jiantou.png",id: "jiantou"},
		{src: "image3/xiangzi.png",id: "xiangzi"},
		
		{src: "image4/datibg.png",id: "datibg"},
		{src: "image4/fou.png",id: "fou"},
		{src: "image4/jindutiao.png",id: "jindutiao"},
		{src: "image4/jindutiaojd.png",id: "jindutiaojd"},
		{src: "image4/shide.png",id: "shide"},
		{src: "image4/wenti1.png",id: "wenti1"},
		{src: "image4/wenti2.png",id: "wenti2"},
		{src: "image4/wenti3.png",id: "wenti3"},
		{src: "image4/wenti4.png",id: "wenti4"},
		
		{src: "image5/che5.png",id: "che5"},
		{src: "image5/info.png",id: "info"},
		{src: "image5/queding5.png",id: "queding5"},
		{src: "image5/renwu5.png",id: "renwu5"},
		{src: "image5/wenzi51.png",id: "wenzi51"},
		
		{src: "image6/chuangguanjieshu.png",id: "chuangguanjieshu"},
		{src: "image6/jieshu1.png",id: "jieshu1"},
		{src: "image6/jieshu2.png",id: "jieshu2"},
		{src: "image6/yaoqinghaoyou.png",id: "yaoqinghaoyou"},
		{src: "image6/qianlaitiyan.png",id: "qianlaitiyan"},
		{src: "image6/quanxintishi.png",id: "quanxintishi"},
		{src: "image6/yuyuechenggong.png",id: "yuyuechenggong"},
		{src: "image6/fxche.png",id: "fxche"},
		{src: "image6/fxxian.png",id: "fxxian"},
	], true, "image/");
	queue.on("progress", function(event) {

		if (queue.progress.toString().length > 4) {
			progress = queue.progress.toString().substr(2, 2);
		} else {
			if (queue.progress.toString().length == 3 || queue.progress.toString().length == 4) {
				progress = queue.progress * 100;
			}

			progress = queue.progress;
		}
		if (progress.toString().indexOf(".") <= 0) {
			if (progress == "00") {
				progress = "0";
			}
			//baifenbi.text = progress + "%";
//			if (progress == "1") {
//				progress = "100";
//				
//			}
			if(progress == "1")
			{
				$(".jdt").html("100%");
				$("#jindudiv").css("display", "none");
			}
			else
			{
				$(".jdt").html(progress + "%");
			}
			if (progress < 100) {
			}
		}

	});
	queue.on("complete", handleComplete, this);
}

var handleComplete = function() {
	Load1();
//	Load4();
	createjs.Ticker.setFPS(60);
	createjs.Ticker.addEventListener("tick", function(event) {
		stage.update();
	})
	
	
}
var che1,wenzi11,wenzi12,wenzi13,wenzi14;
var dibuy = 0;var renwu;
var Load1 = function(){
	Container1.removeAllChildren();
	Container1 = new createjs.Container;
	stage.addChild(Container1);
	var dibu = new createjs.Bitmap(queue.getResult("dibu"));
	dibu.y = bgH - dibu.getBounds().height;
	dibuy = dibu.y;
	var dingbu = new createjs.Bitmap(queue.getResult("dingbu"));
	dingbu.scaleY = (bgH - dibu.getBounds().height+150)/dingbu.getBounds().height;
	
	var men = new createjs.Bitmap(queue.getResult("men"));
	var logo1 = new createjs.Bitmap(queue.getResult("logo1"));
	logo1.x = 35;
	logo1.y = 30;
	var logo2 = new createjs.Bitmap(queue.getResult("logo2"));
	logo2.x = bgW - logo2.getBounds().width - 35;
	logo2.y = 30;
	createjs.Tween.get(logo1).to({x:-logo1.getBounds().width}).to({x:35},500)
	createjs.Tween.get(logo2).to({x:bgW+logo2.getBounds().width}).to({x:bgW - logo2.getBounds().width - 35},500)
	
	renwu = new createjs.Bitmap(queue.getResult("renwu"));
	renwu.x = bgW - renwu.getBounds().width;
	renwu.y = logo2.y + logo2.getBounds().height + 60;
	createjs.Tween.get(renwu).to({x:bgW}).to({x:renwu.x},800);
	
	
	che1 = new createjs.Bitmap(queue.getResult("che1"));
	che1.x = dibu.x + 150 + che1.getBounds().width/2;
	che1.y = dibu.y + 260 + che1.getBounds().height/2;
	che1.regX = che1.getBounds().width >> 1;
	che1.regY = che1.getBounds().height >> 1;
	
	wenzi14 = new createjs.Bitmap(queue.getResult("wenzi14"));
	wenzi14.x = 218;wenzi14.y = che1.y - che1.getBounds().height/2 - wenzi14.getBounds().height - 35;
	wenzi13 = new createjs.Bitmap(queue.getResult("wenzi13"));
	wenzi13.x = 185;wenzi13.y = wenzi14.y - wenzi13.getBounds().height - 30;
	wenzi12 = new createjs.Bitmap(queue.getResult("wenzi12"));
	wenzi12.x = 60;wenzi12.y = wenzi13.y - wenzi12.getBounds().height - 15;
	wenzi11 = new createjs.Bitmap(queue.getResult("wenzi11"));
	wenzi11.x = 60;wenzi11.y = wenzi12.y - wenzi11.getBounds().height - 15;
	
	wenzi11.alpha = wenzi12.alpha = wenzi13.alpha = wenzi14.alpha = 0;
	createjs.Tween.get(che1).to({scaleX:0,scaleY:0,alpha:0}).to({scaleX:1,scaleY:1,alpha:1},1000);
	createjs.Tween.get(wenzi11).to({y:wenzi11.y-10}).to({alpha:1,y:wenzi11.y},500).call(function(){
		createjs.Tween.get(wenzi12).to({x:wenzi12.x-10}).to({alpha:1,x:wenzi12.x},500);
		createjs.Tween.get(wenzi13).to({x:wenzi13.x+10}).to({alpha:1,x:wenzi13.x},500);
		createjs.Tween.get(wenzi14).to({y:wenzi14.y+10}).to({alpha:1,y:wenzi14.y},1000).call(function(){
			createjs.Tween.get(kaishiyouxi).to({alpha:1},500).to({alpha:0.5},500).to({alpha:1},500).to({alpha:0.5},500).to({alpha:1},500).to({alpha:0.5},500).to({alpha:1},500).to({alpha:0.5},500).to({alpha:1},500);
		});
	});
	
	var kaishiyouxi = new createjs.Bitmap(queue.getResult("kaishiyouxi"));
	kaishiyouxi.x = (bgW - kaishiyouxi.getBounds().width)/2;
	kaishiyouxi.y = bgH - kaishiyouxi.getBounds().height - 30;
	kaishiyouxi.alpha = 0;
	kaishiyouxi.addEventListener("mousedown",function(){
		Container1.removeChild(kaishiyouxi);
		createjs.Tween.get(wenzi11).to({alpha:0},500);
		createjs.Tween.get(wenzi12).to({x:-wenzi12.getBounds().width},500);
		createjs.Tween.get(wenzi13).to({x:bgW},500).call(function(){
			createjs.Tween.get(wenzi14).to({alpha:0},500);
			
		});
		createjs.Tween.get(che1).wait(500).to({x:bgW+400,y:che1.y+400},1000).call(function(){
			Load2();
		});
	})
	Container1.addChild(dibu,dingbu,men,logo1,logo2,renwu,che1,wenzi11,wenzi12,wenzi13,wenzi14,kaishiyouxi);
}

var Load2 = function(){
	stage.addChild(Container2);
	var che2 = new createjs.Bitmap(queue.getResult("che2"));
	che2.x = 110 + che2.getBounds().width/2;
	che2.y = dibuy + 230 + che2.getBounds().height/2;
	che2.regX = che2.getBounds().width >> 1;
	che2.regY = che2.getBounds().height >> 1;
	che2.scaleX = che2.scaleY = 0.2;
	che2.alpha = 0;
	createjs.Tween.get(che2).to({x:che2.x+300,y:che2.y}).to({scaleX:1,scaleY:1,x:che2.x,y:che2.y,alpha:1},500,createjs.Ease.bounceOut);
	
	var wenzi21 = new createjs.Bitmap(queue.getResult("wenzi21"));
	wenzi21.x = (bgW - wenzi21.getBounds().width)/2+wenzi21.getBounds().width/2;
	wenzi21.y = che2.y - wenzi21.getBounds().height - che2.getBounds().height/2+wenzi21.getBounds().height/2;
	wenzi21.regX = wenzi21.getBounds().width >> 1;
	wenzi21.regY = wenzi21.getBounds().height >> 1;
	wenzi21.scaleX = 0;
	
	
	var wenzi22 = new createjs.Bitmap(queue.getResult("wenzi22"));
	wenzi22.x = wenzi21.x - 190;
	wenzi22.y = wenzi21.y - 68;
	wenzi22.alpha = 0;
	createjs.Tween.get(wenzi21).to({scaleX:0}).to({scaleX:1},500).call(function(){
		createjs.Tween.get(wenzi22).to({y:wenzi22.y + 10,alpha:1},500);
	});
	
	var wenzi23 = new createjs.Bitmap(queue.getResult("wenzi23"));
	wenzi23.x = (bgW - wenzi23.getBounds().width)/2;
	wenzi23.y = che2.y + che2.getBounds().height-che2.getBounds().height/2-80;
	
	var wenzi24 = new createjs.Bitmap(queue.getResult("wenzi24"));
	wenzi24.x = wenzi23.x + 70;
	wenzi24.y = wenzi23.y + 8;
	var shape = new createjs.Shape();
	shape.graphics.beginFill("red").drawRect(wenzi24.x-wenzi24.getBounds().width,wenzi24.y,wenzi24.getBounds().width,wenzi24.getBounds().height);
	wenzi24.mask = shape;
	shape.alpha = 0.0;
	
	var jinruyouxi = new createjs.Bitmap(queue.getResult("jinruyouxi"));
	jinruyouxi.x = (bgW-jinruyouxi.getBounds().width)/2;
	jinruyouxi.y = bgH - jinruyouxi.getBounds().height - 30;
	jinruyouxi.alpha = 0;
	createjs.Tween.get(shape).wait(200).to({x:495},500).call(function(){
		createjs.Tween.get(jinruyouxi).to({y:jinruyouxi.y-10}).to({y:jinruyouxi.y,alpha:1},500);
	});
	
	var tishi = new createjs.Bitmap(queue.getResult("tishi"));
	tishi.x=(bgW-tishi.getBounds().width)/2;
	tishi.y=(bgH-tishi.getBounds().height)/2;
	var tsshape = new createjs.Shape();
	tsshape.graphics.beginFill("black").drawRect(0,0,bgW,bgH);
	
	var close = new createjs.Shape();
	close.graphics.beginFill("red").drawRect(tishi.x+450,tishi.y+50,100,100);
	tsshape.alpha = tishi.alpha = close.alpha = 0;
	
	Container2.addChild(che2,wenzi21,wenzi22,wenzi23,wenzi24,shape,jinruyouxi,tsshape,tishi,close);
	jinruyouxi.addEventListener("mousedown",function(){
		tsshape.alpha = 0.85;
		tishi.alpha = 1;
		close.alpha = 0.01;
//		wenzi21.alpha = wenzi22.alpha = wenzi23.alpha = wenzi24.alpha = che2.alpha = 0;
//		Container2.removeChild(jinruyouxi);
//		Container1.removeChild(renwu);
//		Load3();
	})
	close.addEventListener("mousedown",function(){
		wenzi21.alpha = wenzi22.alpha = wenzi23.alpha = wenzi24.alpha = che2.alpha = tsshape.alpha = tishi.alpha = close.alpha = 0;
		Container2.removeChild(jinruyouxi);
		Container1.removeChild(renwu);
		Load3();
	})
}
var total = 0;
var Load3 = function(){
	total = 0;
	stage.addChild(Container3);
	var ditu = new createjs.Bitmap(queue.getResult("ditu"));
	ditu.x = (bgW-ditu.getBounds().width)/2;
	ditu.y = (bgH-ditu.getBounds().height)/2;
	
	var jiantou = new createjs.Bitmap(queue.getResult("jiantou"));
	jiantou.x = ditu.x + 110;
	jiantou.y = ditu.y + 180;
	
	var xiangzi1 = new createjs.Bitmap(queue.getResult("xiangzi"));
	xiangzi1.x = ditu.x + 28;
	xiangzi1.y = ditu.y + 560;
	
	var xiangzi2 = new createjs.Bitmap(queue.getResult("xiangzi"));
	xiangzi2.x = ditu.x + 140;
	xiangzi2.y = ditu.y + 350;
	
	var xiangzi3 = new createjs.Bitmap(queue.getResult("xiangzi"));
	xiangzi3.x = ditu.x + 260;
	xiangzi3.y = ditu.y + 480;
	
	var xiangzi4 = new createjs.Bitmap(queue.getResult("xiangzi"));
	xiangzi4.x = ditu.x + 420;
	xiangzi4.y = ditu.y + 330;
	
	var xiangzi5 = new createjs.Bitmap(queue.getResult("xiangzi"));
	xiangzi5.x = ditu.x + 440;
	xiangzi5.y = ditu.y + 580;
	xiangzi2.scaleX = xiangzi2.scaleY = 0.85;
	xiangzi3.scaleX = xiangzi3.scaleY = 0.85;
	xiangzi4.scaleX = xiangzi4.scaleY = 0.85;
	xiangzi5.scaleX = xiangzi5.scaleY = 0.85;
	
	var che3 = new createjs.Bitmap(queue.getResult("che3"));
	che3.x = -60;che3.y = ditu.y + 210;
	
	var chufa = new createjs.Bitmap(queue.getResult("chufa"));
	chufa.x = (bgW - chufa.getBounds().width)/2;
	chufa.y = bgH - chufa.getBounds().height - 30;
	
	var jindutiao = new createjs.Bitmap(queue.getResult("jindutiao"));
	jindutiao.x = (bgW - jindutiao.getBounds().width)/2;
	jindutiao.y = chufa.y - jindutiao.getBounds().height;
	jindutiao.alpha = 0;
	var jindutiaojd = new createjs.Bitmap(queue.getResult("jindutiaojd"));
	jindutiaojd.x = jindutiao.x + 30;
	jindutiaojd.y = jindutiao.y+11;
	jindutiaojd.scaleX = 0;
	
	var datibg = new createjs.Bitmap(queue.getResult("datibg"));
	datibg.x = ditu.x + 110;datibg.y = ditu.y + 210;
	
	Container3.addChild(ditu,jiantou,xiangzi1,xiangzi2,xiangzi4,xiangzi5,che3,chufa,jindutiao,jindutiaojd,datibg);
	
	var wenti1 = new createjs.Bitmap(queue.getResult("wenti1"));
	wenti1.x = datibg.x + 65;
	wenti1.y = datibg.y + 40;
	var shide1 = new createjs.Bitmap(queue.getResult("shide"));
	shide1.x = datibg.x + 60;
	shide1.y = datibg.y + 315;
	var fou1 = new createjs.Bitmap(queue.getResult("fou"));
	fou1.x = datibg.x + 240;
	fou1.y = datibg.y + 315;
	Container3.addChild(wenti1,shide1,fou1);
	
	var wenti2 = new createjs.Bitmap(queue.getResult("wenti2"));
	wenti2.x = datibg.x + 65;
	wenti2.y = datibg.y + 40;
	var shide2 = new createjs.Bitmap(queue.getResult("shide"));
	shide2.x = datibg.x + 60;
	shide2.y = datibg.y + 315;
	var fou2 = new createjs.Bitmap(queue.getResult("fou"));
	fou2.x = datibg.x + 240;
	fou2.y = datibg.y + 315;
	Container3.addChild(wenti2,shide2,fou2);
	
	var wenti3 = new createjs.Bitmap(queue.getResult("wenti3"));
	wenti3.x = datibg.x + 65;
	wenti3.y = datibg.y + 40;
	var shide3 = new createjs.Bitmap(queue.getResult("shide"));
	shide3.x = datibg.x + 60;
	shide3.y = datibg.y + 315;
	var fou3 = new createjs.Bitmap(queue.getResult("fou"));
	fou3.x = datibg.x + 240;
	fou3.y = datibg.y + 315;
	Container3.addChild(wenti3,shide3,fou3);
	
	var wenti4 = new createjs.Bitmap(queue.getResult("wenti4"));
	wenti4.x = datibg.x + 65;
	wenti4.y = datibg.y + 40;
	var shide4 = new createjs.Bitmap(queue.getResult("shide"));
	shide4.x = datibg.x + 60;
	shide4.y = datibg.y + 315;
	var fou4 = new createjs.Bitmap(queue.getResult("fou"));
	fou4.x = datibg.x + 240;
	fou4.y = datibg.y + 315;
	Container3.addChild(wenti4,shide4,fou4);
	datibg.alpha = 0;
	wenti1.alpha = shide1.alpha = fou1.alpha = 0;
	wenti2.alpha = shide2.alpha = fou2.alpha = 0;
	wenti3.alpha = shide3.alpha = fou3.alpha = 0;
	wenti4.alpha = shide4.alpha = fou4.alpha = 0;
	chufa.addEventListener("mousedown",function(){
		Container3.removeChild(chufa);
		createjs.Tween.get(che3).to({y:che3.y+50,x:che3.x+0},1000);
		createjs.Tween.get(jindutiao).to({alpha:1},500).call(function(){
			createjs.Tween.get(jindutiaojd).to({scaleX:1},500);
			createjs.Tween.get(datibg).to({alpha:1},500).call(function(){
				createjs.Tween.get(wenti1).to({x:bgW}).to({x:wenti1.x,alpha:1},500);
				createjs.Tween.get(shide1).to({alpha:1},500);
				createjs.Tween.get(fou1).to({alpha:1},500).call(function(){
					Load31();
				});
			})
		})
	})
	
	var Load31 = function(){

		shide1.addEventListener("mousedown",function(){
			shide1.alpha = fou1.alpha = 0;
			createjs.Tween.get(wenti1).to({x:-wenti1.getBounds().width},500);
			createjs.Tween.get(wenti2).to({x:bgW}).to({x:wenti2.x,alpha:1},500).call(function(){
				shide2.alpha = fou2.alpha = 1;
			});
			
			Load32();
		})
		fou1.addEventListener("mousedown",function(){
			shide1.alpha = fou1.alpha = 0;
			createjs.Tween.get(wenti1).to({x:-wenti1.getBounds().width},500);
			createjs.Tween.get(wenti2).to({x:bgW}).to({x:wenti2.x,alpha:1},500).call(function(){
				shide2.alpha = fou2.alpha = 1;
			});
			total = total + 25;
			Load32();
		})
	}
	var Load32 = function(){
		createjs.Tween.get(jindutiaojd).to({scaleX:2.2},500);
		createjs.Tween.get(che3).to({x:che3.x+300,y:che3.y},1000);
		shide2.addEventListener("mousedown",function(){
			shide2.alpha = fou2.alpha = 0;
			createjs.Tween.get(wenti2).to({x:-wenti2.getBounds().width},500);
			createjs.Tween.get(wenti3).to({x:bgW}).to({x:wenti3.x,alpha:1},500).call(function(){
				shide3.alpha = fou3.alpha = 1;
			});
			total = total + 25;
			Load33();
		})
		fou2.addEventListener("mousedown",function(){
			shide2.alpha = fou2.alpha = 0;
			shide3.alpha = fou3.alpha = 1;
			createjs.Tween.get(wenti2).to({x:-wenti2.getBounds().width},500);
			createjs.Tween.get(wenti3).to({x:bgW}).to({x:wenti3.x,alpha:1},500).call(function(){
				shide3.alpha = fou3.alpha = 1;
			});
			Load33();
		})
	}
	
	var Load33 = function(){
		createjs.Tween.get(che3).to({x:che3.x-300,y:che3.y+300},1000);
		createjs.Tween.get(jindutiaojd).to({scaleX:3.3},500);
		shide3.addEventListener("mousedown",function(){
			shide3.alpha = fou3.alpha = 0;
			createjs.Tween.get(wenti3).to({x:-wenti3.getBounds().width},500);
			createjs.Tween.get(wenti4).to({x:bgW}).to({x:wenti4.x,alpha:1},500).call(function(){
				shide4.alpha = fou4.alpha = 1;
			});
//			total = total + 25;
			Load34();
		})
		fou3.addEventListener("mousedown",function(){
			shide3.alpha = fou3.alpha = 0;
			createjs.Tween.get(wenti3).to({x:-wenti3.getBounds().width},500);
			createjs.Tween.get(wenti4).to({x:bgW}).to({x:wenti4.x,alpha:1},500).call(function(){
				shide4.alpha = fou4.alpha = 1;
			});
			total = total + 25;
			Load34();
		})
	}
	var Load34 = function(){
		createjs.Tween.get(che3).to({x:che3.x+300,y:che3.y+0},1000);
		createjs.Tween.get(jindutiaojd).to({scaleX:4.4},500);
		shide4.addEventListener("mousedown",function(){
			shide4.alpha = fou4.alpha = 0;
			createjs.Tween.get(wenti4).to({alpha:0},500);
			createjs.Tween.get(datibg).to({alpha:0},500).call(function(){
				Load35();
			});
			total = total + 25;
		})
		fou4.addEventListener("mousedown",function(){
			shide4.alpha = fou4.alpha = 0;
			createjs.Tween.get(wenti4).to({alpha:0},500);
			createjs.Tween.get(datibg).to({alpha:0},500).call(function(){
				Load35();
			});
		})
	}
	var Load35 = function(){
		jindutiao.alpha = jindutiaojd.alpha = jiantou.alpha = 0;
		createjs.Tween.get(xiangzi1).to({x:-200},500);
		createjs.Tween.get(xiangzi2).to({x:-200},600);
		createjs.Tween.get(xiangzi3).to({y:-200},600);
		createjs.Tween.get(xiangzi4).to({x:bgW+200},700);
		createjs.Tween.get(xiangzi5).to({x:bgW+200},800);
		createjs.Tween.get(che3).to({x:bgW+200,y:che3.y+200},800);
		createjs.Tween.get(ditu).wait(800).to({scaleX:0,scaleY:0,x:bgW/2,y:bgH/2,alpha:0},500).call(function(){
			Load4();
		});
	}
}

var Load4 = function(){
	stage.addChild(Container4);
	var info = new createjs.Bitmap(queue.getResult("info"));
	info.x = (bgW-info.getBounds().width)/2;
	info.y = (bgH-info.getBounds().height)/2;
	
	var che5 = new createjs.Bitmap(queue.getResult("che5"));
	che5.x = 0
	che5.y = bgH-che5.getBounds().height;
	che5.alpha = 0;
	
	
	var wenzi51 = new createjs.Bitmap(queue.getResult("wenzi51"));
	wenzi51.x = (bgW-wenzi51.getBounds().width)/2;
	wenzi51.y = info.y - wenzi51.getBounds().height-40;
	
	var queding5 = new createjs.Bitmap(queue.getResult("queding5"));
	queding5.x = (bgW-queding5.getBounds().width)/2;
	queding5.y = info.y + info.getBounds().height + 40;
	queding5.alpha = 0;
	var renwu5 = new createjs.Bitmap(queue.getResult("renwu5"));
	renwu5.x = bgW - renwu5.getBounds().width;
	renwu5.y = renwu.y;
	Container4.addChild(che5,renwu5,info,wenzi51,queding5);
	var datibg = new createjs.Bitmap(queue.getResult("datibg"));
	datibg.x = (bgW-datibg.getBounds().width)/2;
	datibg.y = (bgH-datibg.getBounds().height)/2;
	
	var chuangguanjieshu = new createjs.Bitmap(queue.getResult("chuangguanjieshu"));
	chuangguanjieshu.x = datibg.x + 40;
	chuangguanjieshu.y = datibg.y + 80;
	
	var jieshu1 = new createjs.Bitmap(queue.getResult("jieshu1"));
	jieshu1.x = datibg.x + 75;
	jieshu1.y = datibg.y + 315;
	var jieshu2 = new createjs.Bitmap(queue.getResult("jieshu2"));
	jieshu2.x = datibg.x + 75;
	jieshu2.y = datibg.y + 315;
	
	var yuyuechenggong = new createjs.Bitmap(queue.getResult("yuyuechenggong"));
	yuyuechenggong.x = (bgW-yuyuechenggong.getBounds().width)/2;
	yuyuechenggong.y = wenzi14.y+wenzi14.getBounds().height-yuyuechenggong.getBounds().height;
	
	var yaoqinghaoyou = new createjs.Bitmap(queue.getResult("yaoqinghaoyou"));
	yaoqinghaoyou.x = (bgW-yaoqinghaoyou.getBounds().width)/2;
	yaoqinghaoyou.y = bgH-yaoqinghaoyou.getBounds().height - 30;
	yaoqinghaoyou.addEventListener("mousedown",function(){
		Container5.removeAllChildren();
		Container5 = new createjs.Container;
		var fxxian = new createjs.Bitmap(queue.getResult("fxxian"));
		fxxian.x = bgW - fxxian.getBounds().width - 60;
		fxxian.y = 60;
		var fxche = new createjs.Bitmap(queue.getResult("fxche"));
		fxche.x = fxxian.x + 40;fxche.y = fxxian.y + 630;
		fxche.regX = fxche.getBounds().width >> 1;
		fxche.regY = fxche.getBounds().height >> 1;
		fxche.rotation = 36;
		var shapefx = new createjs.Shape();
		shapefx.graphics.beginFill("black").drawRect(0,0,bgW,bgH);
		stage.addChild(Container5);
		
		var logo1 = new createjs.Bitmap(queue.getResult("logo1"));
		logo1.x = 35;
		logo1.y = 30;
		var logo2 = new createjs.Bitmap(queue.getResult("logo2"));
		logo2.x = bgW - logo2.getBounds().width - 35;
		logo2.y = 30;
		Container5.addChild(shapefx,fxxian,fxche,logo1,logo2);
		shapefx.alpha = 0.85;
		createjs.Tween.get(fxche,{loop:true}).to({x:fxche.x+170,y:fxche.y-100,rotation:13},250).to({x:fxche.x+260,y:fxche.y-200,rotation:0},250).to({x:fxche.x+350,y:fxche.y-400,rotation:-12},250).to({x:fxche.x+370,y:fxche.y-550,rotation:-20},250);
		Container5.addEventListener("mousedown",function(){
			Container5.alpha = 0;
		})
	})
	Container4.addChild(datibg,chuangguanjieshu,jieshu1,jieshu2,yaoqinghaoyou);
	jieshu1.alpha = jieshu2.alpha = yuyuechenggong.alpha = yaoqinghaoyou.alpha = info.alpha = 0;
	
	if(total==100)
	{
		jieshu2.alpha = 1;
	}
	else
	{
		jieshu1.alpha = 1;
	}
	che1.x = 150 + che1.getBounds().width/2;
	che1.y = dibuy + 260 + che1.getBounds().height/2;
	che1.alpha = 0;
	
	var quanxintishi = new createjs.Bitmap(queue.getResult("quanxintishi"));
	quanxintishi.x = (bgW-quanxintishi.getBounds().width)/2;
	quanxintishi.y = (bgH-quanxintishi.getBounds().height)/2;
	var qianlaitiyan = new createjs.Bitmap(queue.getResult("qianlaitiyan"));
	qianlaitiyan.x = (bgW-qianlaitiyan.getBounds().width)/2;
	qianlaitiyan.y = bgH-qianlaitiyan.getBounds().height-30;
	var quanshape = new createjs.Shape();
	quanshape.graphics.beginFill("black").drawRect(0,0,bgW,bgH);
	
	quanshape.alpha = quanxintishi.alpha = qianlaitiyan.alpha = 0;
	Container4.addChild(quanshape,quanxintishi,qianlaitiyan);
	setTimeout(function(){

		quanshape.alpha = 0.85;
		quanxintishi.alpha = qianlaitiyan.alpha = 1;
		qianlaitiyan.addEventListener("mousedown",function(){
			quanshape.alpha = quanxintishi.alpha = qianlaitiyan.alpha = 0;
			datibg.alpha = jieshu1.alpha = jieshu2.alpha = chuangguanjieshu.alpha = 0;
			che1.alpha = wenzi11.alpha = wenzi12.alpha = wenzi13.alpha = wenzi14.alpha = 0;
			info.alpha = queding5.alpha = 1;
			$("#info").css({"display":"block","left":info.x+180,"top":info.y+35});
			createjs.Tween.get(che5).to({x:-che5.getBounds().width}).to({x:che5.x,alpha:1},500);
		})
		
	},2000)
		
	queding5.addEventListener("mousedown",function(){
		var xingming = $("#xingming").val();
//		var xingbie = $("#xingbie").val();
		var dianhua = $("#dianhua").val();
//		var chengshi = $("#chengshi").val();
		
		var xingbie = $("#xingbie select").val();
		var chengshi = $("#chengshi select").val();
// 		var chengshi = $("#demo2").val();
   		
		if(xingming==""||xingming.length>10)
		{
			alert("请输入正确的姓名!");return;
		}
		if(xingbie==""||xingbie.length>6)
		{
			alert("请输入正确的性别!");return;
		}
		if(chengshi==""||chengshi.length>15)
		{
			alert("请输入正确的城市!");return;
		}
		if(dianhua==""||dianhua.length!=11||dianhua.substr(0,1)!="1"||dianhua.substr(1,1)=="2")
		{
			alert("请输入正确的手机号码!");return;
		}
		$.post("shuju.php?jieshou=tijiao",{openid:openid,xingming:xingming,xingbie:xingbie,chengshi:chengshi,dianhua:dianhua},function(text){
			console.log(text);
		})
		$("#info").css("display","none");
		che5.alpha = 0;
		queding5.alpha = wenzi51.alpha = info.alpha = 0;
		datibg.alpha = chuangguanjieshu.alpha = 0;
		
		che1.alpha = wenzi11.alpha = wenzi12.alpha = wenzi13.alpha = wenzi14.alpha = 1;
		wenzi13.x = 185;
		wenzi12.x = 60;
		
		Container4.addChild(wenzi11,wenzi12,wenzi13,wenzi14,yuyuechenggong);
		yuyuechenggong.alpha = yaoqinghaoyou.alpha = 1;

//		if(total==100)
//		{
//			jieshu2.alpha = 1;
//		}
//		else
//		{
//			jieshu1.alpha = 1;
//		}
//		che1.x = 150 + che1.getBounds().width/2;
//		che1.y = dibuy + 260 + che1.getBounds().height/2;
//		che1.alpha = 1;
//		setTimeout(function(){
//			datibg.alpha = jieshu1.alpha = jieshu2.alpha = chuangguanjieshu.alpha = 0;
//			che1.alpha = wenzi11.alpha = wenzi12.alpha = wenzi13.alpha = wenzi14.alpha = 1;
//			wenzi13.x = 185;
//			wenzi12.x = 60;
//			
//			Container4.addChild(wenzi11,wenzi12,wenzi13,wenzi14,yuyuechenggong);
//			yuyuechenggong.alpha = yaoqinghaoyou.alpha = 1;
//		},2000)
	})
}
























































































